package com.my.config.ds.datarouting;

public class DbContextHolder {
    private static final ThreadLocal<DataSourceKeyEnum> contextHolder = new ThreadLocal();

    public DbContextHolder() {
    }

    public static void setDataSourceKey(DataSourceKeyEnum dataSourceKey) {
        contextHolder.set(dataSourceKey);
    }

    public static DataSourceKeyEnum getDataSourceKey() {
        return (DataSourceKeyEnum)contextHolder.get();
    }

    public static void cleanDataSourceKey() {
        contextHolder.remove();
    }
}